package com.acegear.horizon.domain.repository.jpa;

import com.acegear.horizon.domain.models.jpa.EventLike;

import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;
import java.util.Optional;

/**
 * Created by wangsike on 2017/2/14.
 */
public interface EventLikeRepository extends PagingAndSortingRepository<EventLike, Long> {

    Integer countByEventId(Long eventId);

    Integer countByUserId(Long userId);

    void deleteByEventIdAndUserId(Long eventId, Long userId);

    List<EventLike> findByUserId(Long userId, Pageable pageable);

    Optional<EventLike> findTopByUserIdAndEventId(Long userId, Long eventId);
}
